---
title: "Optimize"
author: "`r Sys.info()['user']`"
date: "`r format(Sys.time(), '%Y-%m-%d')`"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.width = 10, fig.height = 5)
source("functions.R")
```

```{r}
dat_ja <- readRDS("data_optimize_ja.RDS")
dat_he <- readRDS("data_optimize_he.RDS")
```

```{r fig.height=4, fig.width=10}
par(mfrow = c(1, 2))
plot(dat_ja$w, dat_ja$r2, lwd = 2,type = "l", col = color[2], ylab = expression(R^2),
     main = "Japan", font.main = 1, xlab = "window (days)")
abline(v = 60, lty = 3)
plot(dat_he$w, dat_he$r2, lwd = 2,type = "l", col = color[2], ylab = expression(R^2),
     main = "Israel", font.main = 1, xlab = "window (days)")
abline(v = 30, lty = 3)
par(mfrow = c(1, 1))
```